package com.yao_shop.controller;

import com.yao_shop.service.Impl.token_serviceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
public class TokenController {
    @Autowired
    token_serviceImpl token_service;

    @ResponseBody
    @GetMapping("Test_token.do")
    public String test_token(@RequestParam Map map, HttpServletRequest request){
        String token = request.getHeader("token");
        boolean panduan = token_service.panduan(token);
        System.out.println(panduan);
        try {
            if(panduan==true){
                String s = token_service.gettoken_info(token);
                return s.toString();
            }else{
                return "\"false\"";
            }
        }catch (Exception e){
            System.out.println(e.toString());
            return e.getMessage();
        }
    }

}
